package com.example.userservice.feign;

import com.example.userservice.common.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

@FeignClient(name = "permissionService")
public interface PermissionFeign {

    @PostMapping("/permission/bind/{userId}")
    Result<Void> bindDefaultRole(@PathVariable("userId") Long userId);

    @GetMapping("/permission/code/{userId}")
    Result<String> getUserRoleCode(@PathVariable("userId") Long userId);

    @PutMapping("/permission/upgrade/{userId}")
    Result<Void> upgradeToAdmin(@PathVariable("userId") Long userId);

    @PutMapping("/permission/downgrade/{userId}")
    Result<Void> downgradeToUser(@PathVariable("userId") Long userId);

    @GetMapping("permission/users")
    Result<List<Long>> getUser();
}
